package com.hbzhit.modules.act.handle.impl;

import com.hbzhit.modules.act.factory.ProcessServiceFactory;
import com.hbzhit.modules.act.handle.WorkFlowTask;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.task.Comment;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 任务处理类
 *
 * @author DING
 * @date 2019年7月23日
 */
@Slf4j
@Component("workFlowTaskHandler")
public class WorkFlowTaskHandler extends ProcessServiceFactory implements WorkFlowTask {

    @Override
    public void claim(String taskId, String userId) {
        taskService.claim(taskId, userId);
    }

    @Override
    public void unclaim(String taskId) {
        taskService.unclaim(taskId);
    }

    @Override
    public void complete(String taskId) {
        this.complete(taskId, null);
    }

    @Override
    public void complete(String taskId, Map<String, Object> variables) {
        taskService.complete(taskId, variables);
        log.info("-----------任务ID：{},已完成-----------", taskId);
    }

    @Override
    public void setAssignee(String taskId, String userId) {
        taskService.setAssignee(taskId, userId);
    }

    @Override
    public void addCandidateUser(String taskId, String userId) {
        taskService.addCandidateUser(taskId, userId);
    }

    @Override
    public Comment addComment(String taskId, String processInstanceId, String message) {
        return taskService.addComment(taskId, processInstanceId, message);
    }

    @Override
    public Comment addComment(String taskId, String processInstanceId, String type, String message) {
        return taskService.addComment(taskId, processInstanceId, type, message);
    }

    @Override
    public void setVariableLocal(String taskId, String variableName, Object value) {
        taskService.setVariableLocal(taskId, variableName, value);
    }

}

